Skip to content

State the memory image of every value type a binding carries - #189

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/value-image-facts
Oct 11, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/value-image-facts

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Every defined structure states the bytes clang lays it in, its trailing padding included, as
sizeBytes beside the offset_bits of its fields: extract_struct of parser/extractors.py reads it
from the record type clang already lays out for the offsets, so a Span states 24, a TBox 56, an
STBox 80, an Npoint 16 and an Nsegment 24. A structure only declared, such as Raster or Pose,
has no size and states none.

Each class of typeEncodings that MEOS copies states the memory image of its values in image:
copy names the public T *f(const T *) named *_copy, and the image's length is either the public
int f(const T *) named *_mem_size, as size, or, for a type no such function sizes, the
sizeBytes of its structure. _image of parser/codecs.py finds both by shape and name, as
_byte_codec finds the byte codec, and stops the catalog on two copy or two size functions for
one class. A structure ending in a flexible array member is variable-length, so a class over
one states no image without a *_mem_size. Temporal states {copy: temporal_copy, size:
temporal_mem_size}, Raster {copy: raster_copy, size: raster_mem_size} and Span {copy:
span_copy, sizeBytes: 24}; the classes MEOS passes by value or copies through no public
function, H3Index and TimestampTz among them, state none.

The floor of .github/workflows/pytest.yml rises to 546, the suite collecting the two size tests
of StructLayoutTests, the six of ImageTests and the two image tests of CodecContractTests.

Witness: against MEOS-API master 4baf117 over MobilityDB master 4eef012a9f the Span structure
states the offsets of its fields and no size, and typeEncodings states no copy or size of any
class; against this branch Span states sizeBytes 24, typeEncodings.Span.image reads {copy:
span_copy, sizeBytes: 24} and typeEncodings.Raster.image {copy: raster_copy, size:
raster_mem_size}.

Measured over MobilityDB master 4eef012a9f with an all-families libmeos, run.py on upstream
4baf117 and on this branch with the same installed headers: the two catalogs differ in added
keys alone, every key of every function and of the object model being identical; 71 of the 83
structures state sizeBytes, the 12 others being only declared; 21 of the 34 classes of
typeEncodings state an image, 13 sized by a function (Cbuffer, GSERIALIZED, JsonPath, Jsonb,
Pcpatch, Pcpoint, Pose, PoseChain, Raquet, Raster, Set, SpanSet, Temporal) and 8 by their
structure (Interval 16, Npoint 16, Nsegment 24, STBox 80, Span 24, TBox 56, TPCBox 88,
TimeTzADT 16). The suite collects 546 tests, all passing, none skipped. JMEOS main e8c65dc4
generates byte-identical sources from both catalogs: its GeneratedFunctions and object layer,
and its Spark, Flink, Kafka, Spark SQL and Flink SQL surfaces.

Why: a binding holding MEOS values in process carries each as its memory image, allocated to
the size the catalog states and duplicated by the copy it names, and reads both from the
catalog rather than from a table of its own.

Every defined structure states the bytes clang lays it in, its trailing padding included, as
sizeBytes beside the offset_bits of its fields: extract_struct of parser/extractors.py reads it
from the record type clang already lays out for the offsets, so a Span states 24, a TBox 56, an
STBox 80, an Npoint 16 and an Nsegment 24. A structure only declared, such as Raster or Pose,
has no size and states none.

Each class of typeEncodings that MEOS copies states the memory image of its values in image:
copy names the public T *f(const T *) named *_copy, and the image's length is either the public
int f(const T *) named *_mem_size, as size, or, for a type no such function sizes, the
sizeBytes of its structure. _image of parser/codecs.py finds both by shape and name, as
_byte_codec finds the byte codec, and stops the catalog on two copy or two size functions for
one class. A structure ending in a flexible array member is variable-length, so a class over
one states no image without a *_mem_size. Temporal states {copy: temporal_copy, size:
temporal_mem_size}, Raster {copy: raster_copy, size: raster_mem_size} and Span {copy:
span_copy, sizeBytes: 24}; the classes MEOS passes by value or copies through no public
function, H3Index and TimestampTz among them, state none.

The floor of .github/workflows/pytest.yml rises to 546, the suite collecting the two size tests
of StructLayoutTests, the six of ImageTests and the two image tests of CodecContractTests.

Witness: against MEOS-API master 4baf117 over MobilityDB master 4eef012a9f the Span structure
states the offsets of its fields and no size, and typeEncodings states no copy or size of any
class; against this branch Span states sizeBytes 24, typeEncodings.Span.image reads {copy:
span_copy, sizeBytes: 24} and typeEncodings.Raster.image {copy: raster_copy, size:
raster_mem_size}.

Measured over MobilityDB master 4eef012a9f with an all-families libmeos, run.py on upstream
4baf117 and on this branch with the same installed headers: the two catalogs differ in added
keys alone, every key of every function and of the object model being identical; 71 of the 83
structures state sizeBytes, the 12 others being only declared; 21 of the 34 classes of
typeEncodings state an image, 13 sized by a function (Cbuffer, GSERIALIZED, JsonPath, Jsonb,
Pcpatch, Pcpoint, Pose, PoseChain, Raquet, Raster, Set, SpanSet, Temporal) and 8 by their
structure (Interval 16, Npoint 16, Nsegment 24, STBox 80, Span 24, TBox 56, TPCBox 88,
TimeTzADT 16). The suite collects 546 tests, all passing, none skipped. JMEOS main e8c65dc4
generates byte-identical sources from both catalogs: its GeneratedFunctions and object layer,
and its Spark, Flink, Kafka, Spark SQL and Flink SQL surfaces.

Why: a binding holding MEOS values in process carries each as its memory image, allocated to
the size the catalog states and duplicated by the copy it names, and reads both from the
catalog rather than from a table of its own.
@estebanzimanyi
estebanzimanyi merged commit 24767e1 into MobilityDB:master Oct 11, 2026
3 checks passed
@estebanzimanyi
estebanzimanyi deleted the catalog/value-image-facts branch October 11, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant